# Maintainer: kpcyrd <kpcyrd[at]archlinux[dot]org>
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Vlad M. <vlad@archlinux.net>

pkgname=cargo-watch
pkgver=8.4.1
pkgrel=1
pkgdesc="Utility for Cargo to compile projects when sources change"
url='https://github.com/watchexec/cargo-watch'
arch=('loong64' 'x86_64')
license=('CC0-1.0')
depends=('cargo')
makedepends=('ruby-ronn')
source=("https://github.com/watchexec/${pkgname}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha256sums=('af1b649de787630144ccbb510b854d2e2a21b91df6cc7e0f420fd14518978572')
b2sums=('7928a155b57ef50482f7ba3ac4ad576d4360cdde6ea1a52aa65a2c26527a33ecad0c44a4314d4b95d83783b4db2db5582b5b3faf2f927c13e3ac2a70cf0b27a6')

prepare() {
  cd "${pkgname}-${pkgver}"
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
  cd ${pkgname}-${pkgver}
  cargo build --frozen --release
  ronn --roff cargo-watch.1.ronn
}

package() {
  cd ${pkgname}-${pkgver}
  install -Dm 755 "target/release/${pkgname}" -t "${pkgdir}/usr/bin"

  install -Dm 644 completions/zsh "${pkgdir}/usr/share/zsh/site-functions/_cargo-watch"
  install -Dm 644 cargo-watch.1 -t "${pkgdir}/usr/share/man/man1"

  install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
